#ifndef __SCENE_OBJECT_H_
#define __SCENE_OBJECT_H_

#include <map>
#include <string>
#include "../pipeline/utils.h"
#include <vector>
#include "rectangle.h"

struct ObjectVertices{
	Vertexf* vertices;
	unsigned int nVertices;

	ObjectVertices(){
		this->vertices = NULL;
		this->nVertices = 0;
	}
};

class SceneObject{
	protected:
		std::map<std::string,SceneObject*> listObject;
		ObjectVertices objVertices;
		Rectangle dimensions;
		float speed;
		bool kill;

	public:
		SceneObject();
		SceneObject(float x1,float x2,float y1,float y2);
		SceneObject(Rectangle rec);
		virtual ~SceneObject();

		virtual void addObject(const std::string& name,SceneObject* obj);
		void removeObject(const std::string& name);
		SceneObject& findObject(const std::string& name)const;
		SceneObject* getObject(const std::string& name);

		void setSpeed(float sp){this->speed=sp;}
		float getSpeed(){ return this->speed;}

		void setKill(bool kill){
			this->kill = kill;
		}

		bool isKilled(){
			return kill;
		}

		void setDimensions(float x1,float x2,float y1,float y2);
		Rectangle& getDimensions(){ return dimensions;}

		virtual void move(float dx,float dy){
			this->dimensions.translate(dx,dy);
		}

		virtual void draw()=0;
		virtual void timeStep(){}
};

#endif //__SCENE_OBJECT_H_
